package com.coolcode.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@TableName("sys_menu")
@Data
@ToString
public class Menu implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id")
    private Long id;

    /**
     * 父级Id
     */
    private Long parentId;

    /**
     * 层级
     */
    private Integer level;

    /**
     * 菜单名
     */
    private String name;

    /**
     * 路由地址
     */
    private String path;

    /**
     * 菜单状态(1显示 0隐藏)
     */
    private String visible;

    /**
     * 菜单状态(1停用 0正常)
     */
    private String status;

    private List<Menu> children;

    public List<Menu> getChildren() {

        if (children == null) {
            children = new ArrayList<>();
        }
        return children;
    }
}
